<?php

use yii\db\Migration;

/**
 * Handles the creation of table `message`.
 */
class m171027_023450_create_message_table extends Migration
{
    /**
     * @inheritdoc
     */
    public function up()
    {
        $this->createTable('message', [
            'id' => $this->bigPrimaryKey(),
            'category' => $this->smallInteger()->notNull()->comment('类别'),//1待审批提醒、2审批反馈、3关注更新
            'sender' => $this->integer()->notNull()->comment('发送人'),
            'receiver' => $this->integer()->notNull()->comment('接收人'),
            'title' => $this->string()->notNull()->comment('标题'),
            'content' => $this->text()->notNull()->comment('内容'),
            'created_at' => $this->timestamp()->comment('发送时间'),
            'is_read' => $this->smallInteger()->comment('是否阅读'),
        ]);
    }

    /**
     * @inheritdoc
     */
    public function down()
    {
        $this->dropTable('message');
    }
}
